<?php
include_once "Context.php";
include_once "Concrete/StateA.php";
include_once "Concrete/StateB.php";

use State\Context;
use State\Concrete\StateA;
/** 实例化Context类，并设置初始化state为StateA */
$c = new Context(new StateA());
/** state == A */
echo "当前state: " . PHP_EOL;
var_dump($c->state);
echo PHP_EOL;
$c->request();
/** state == B */
echo "当前state: " . PHP_EOL;
var_dump($c->state);
echo PHP_EOL;
$c->request();
/** state == A */
echo "当前state: " . PHP_EOL;
var_dump($c->state);
echo PHP_EOL;